home *** CD-ROM | disk | FTP | other *** search
/ Hacker's Arsenal - The Cutting Edge of Hacking / Hacker's Arsenal - The Cutting Edge of Hacking.iso / texts / misc / TCP-IP.txt < prev    next >
Encoding:
Text File  |  2001-07-11  |  34.1 KB  |  872 lines

  1. Archive-name:tcp-ip/FAQ
  2. Last-modified:  1996/4/1
  3.  
  4. Internet Protocol Frequently Asked Questions
  5.  
  6. Maintained by: George V. Neville-Neil (gnn@wrs.com)
  7. Contributions from:
  8. Ran Atkinson
  9. Mark Bergman
  10. Stephane Bortzmeyer
  11. Rodney Brown
  12. Dr. Charles E. Campbell Jr.
  13. Phill Conrad 
  14. Alan Cox
  15. Rick Jones
  16. Jon Kay 
  17. Jay Kreibrich
  18. William Manning
  19. Barry Margolin 
  20. Jim Muchow
  21. Subu Rama
  22. W. Richard Stevens 
  23.  
  24. Version 3.3
  25.  
  26.  
  27. ************************************************************************
  28.  
  29.     The following is a list of Frequently Asked Questions, and
  30. their answers, for people interested in the Internet Protocols,
  31. including TCP, UDP, ICMP and others.  Please send all additions,
  32. corrections, complaints and kudos to the above address.  This FAQ will
  33. be posted on or about the first of every month.
  34.  
  35.     This FAQ is available for anonymous ftp from :
  36. ftp.netcom.com:/pub/gnn/tcp-ip.faq .  You may get it from my home page at
  37. ftp://ftp.netcom.com/pub/gnn/gnn.html
  38.     You can read the FAQ in HTMl format on Netcom or from the mirror 
  39. site http://web.cnam.fr/Network/TCP-IP/tcp-ip.html
  40.  
  41. ************************************************************************
  42.  
  43. Table of Contents:
  44. Glossary
  45. 1) Are there any good books on IP?
  46. 2) Where can I find example source code for TCP/UDP/IP?
  47. 3) Are there any public domain programs to check the performance of an
  48. IP link? 
  49. 4) Where do I find RFCs?
  50. 5) How can I detect that the other end of a TCP connection has
  51. crashed?  Can I use "keepalives" for this?
  52. 6) Can the keepalive timeouts be configured?
  53. 7) Can I set up a gateway to the Internet that translates IP
  54. addresses, so that I don't have to change all our internal addresses 
  55. to an official network? 
  56. 8) Are there object-oriented network programming tools?
  57. 9) What other FAQs are related to this one?
  58. 10) What newsgroups contain information on networks/protocols?
  59. 11) Van Jacobson explains TCP congestion avoidance.
  60. 12) Can I use a single bit subnet?
  61.  
  62. Glossary:
  63.  
  64. I felt this should be first given the plethora of acronyms used in the
  65. rest of this FAQ.
  66.  
  67. IP: Internet Protocol.  The lowest layer protocol defined in TCP/IP.
  68. This is the base layer on which all other protocols mentioned herein
  69. are built.  IP is often referred to as TCP/IP as well.
  70.  
  71. UDP: User Datagram Protocol.  This is a connectionless protocol built
  72. on top of IP.  It does not provide any guarantees on the ordering or
  73. delivery of messages.  This protocol is layered on top of IP.
  74.  
  75. TCP: Transmission Control Protocol.  TCP is a connection oriented
  76. protocol that guarantees that messages are delivered in the order in
  77. which they were sent and that all messages are delivered.  If a TCP
  78. connection cannot deliver a message it closes the connection and
  79. informs the entity that created it.  This protocol is layered on top
  80. of IP.
  81.  
  82. ICMP:  Internet Control Message Protocol.  ICMP is used for
  83. diagnostics in the network.  The Unix program, ping, uses ICMP
  84. messages to detect the status of other hosts in the net.  ICMP
  85. messages can either be queries (in the case of ping) or error reports,
  86. such as when a network is unreachable.
  87.  
  88. RFC: Request For Comment.  RFCs are documents that define the
  89. protocols used in the IP Internet.  Some are only suggestions, some
  90. are even jokes, and others are published standards.  Several sites in
  91. the Internet store RFCs and make them available for anonymous ftp.
  92.  
  93. SLIP:  Serial Line IP.  An implementation of IP for use over a serial
  94. link (modem).  CSLIP is an optimized (compressed) version of SLIP that
  95. gives better throughput.
  96.  
  97. Bandwidth:  The amount of data that can be pushed through a link in
  98. unit time.  Usually measured in bits or bytes per second.
  99.  
  100. Latency:  The amount of time that a message spends in a network going
  101. from point A to point B.
  102.  
  103. Jitter:  The effect seen when latency is not a constant.  That is, if
  104. messages experience a different latencies between two points in a
  105. network.
  106.  
  107. RPC:  Remote Procedure Call.  RPC is a method of making network access
  108. to resource transparent to the application programmer by supplying a
  109. "stub" routine that is called in the same way as a regular procedure
  110. call.  The stub actually performs the call across the network to
  111. another computer.
  112.  
  113. Marshalling:  The process of taking arbitrary data (characters,
  114. integers, structures) and packing them up for transmission across a
  115. network.
  116.  
  117. MBONE: A virtual network that is a Multicast backBONE.  It is still a
  118. research prototype, but it extends through most of the core of the
  119. Internet (including North America, Europe, and Australia).  It uses IP
  120. Multicasting which is defined in RFC-1112.  An MBONE FAQ is available
  121. via anonymous ftp from: ftp.isi.edu" There are frequent broadcasts of
  122. multimedia programs (audio and low bandwidth video) over the MBONE.
  123. Though the MBONE is used for mutlicasting, the long haul parts of the
  124. MBONE use point-to-point connections through unicast tunnels to
  125. connect the various multicast networks worldwide.
  126.  
  127.  
  128. 1) Are there any good books on IP?
  129.  
  130. A) Yes.  Please see the following:
  131.  
  132. Internetworking with TCP/IP Volume I
  133. (Principles, Protocols, and Architecture)
  134. Douglas E. Comer
  135. Prentice Hall 1991 ISBN 0-13-468505-9
  136.  
  137. This volume covers all of the protocols, including IP, UDP, TCP, and
  138. the gateway protocols.  It also includes discussions of higher level
  139. protocols such as FTP, TELNET, and NFS.
  140.  
  141. Internetworking with TCP/IP Volume II
  142. (Design, Implementation, and Internals)
  143. Douglas E. Comer / David L. Stevens
  144. Prentice Hall 1991  ISBN 0-13-472242-6
  145.  
  146. Discusses the implementation of the protocols and gives numerous code
  147. examples.
  148.  
  149. Internetworking with TCP/IP Volume III (BSD Socket Version)
  150. (Client - Server Programming and Applications)
  151. Douglas E. Comer / David L. Stevens
  152. Prentice Hall 1993  ISBN 0-13-474222-2
  153.  
  154. This book discusses programming applications that use the internet
  155. protocols.  It includes examples of telnet, ftp clients and servers.
  156. Discusses RPC and XDR at length.
  157.  
  158. TCP/IP Illustrated, Volume 1: The Protocols, 
  159. W. Richard Stevens
  160. (c) Addison-Wesley, 1994  ISBN 0-201-63346-9
  161.  
  162. An excellent introduction to the entire TCP/IP protocol suite,
  163. covering all the major protocols, plus several important applications.
  164.  
  165. "TCP/IP Illustrated, Volume 2: The Implementation",
  166. by Gary R. Wright and W. Richard Stevens
  167. (c) Addison-Wesley, 1995
  168. ISBN 0-201-63354-X
  169.  
  170. This is a complete, and lenthy, discussion of the internals of TCP/IP
  171. based on the Net/2 release of BSD.
  172.  
  173. Unix Network Programming
  174. W. Richard Stevens
  175. Prentice Hall 1990  ISBN 0-13-949876
  176.  
  177. An excellent introduction to network programming under Unix.
  178.  
  179. The Design and Implementation of the 4.3 BSD Operating System
  180. Samuel J. Leffler, Marshall Kirk McKusick, Michael J. Karels, John S.
  181. Quarterman 
  182. Addison-Wesley 1989  ISBN 0-201-06196-1
  183.  
  184. Though this book is a reference for the entire operating system, the
  185. eleventh and twelfth chapters completely explain how the networking
  186. protocols are implemented in the kernel.
  187.  
  188. Stevens, W. Richard, Unix Network Programming.  1990, Prentice-Hall.
  189.  
  190. An excellent introduction to network programming under Unix.   Widely
  191. cited on the Usenet bulliten boards as the "best place to start" if you
  192. want to actually learn how to write Unix programs that communicate over
  193. a network.  
  194.  
  195. Rago, Steven A.  Unix System V. Network Programming.  1993, Addison-Wesley.
  196.  
  197. A book that covers the same kinds of topics as W. Richard Stevens Unix
  198. Network Programming, but is more specific to Unix System V Release 4
  199. (SVR4), and so perhaps is more useful and up to date if you are
  200. working specifically with that implementation.  (Stevens book covers
  201. Unix System V release 3.x).  There is a much more extensive coverage
  202. of Streams in Rago's book; 4 chapters, where Stevens only provides a
  203. couple of subsections.  The design project at the end of the book is
  204. an implementation of SLIP.
  205.  
  206.  
  207. 2)  Where can I find example source code for TCP/UDP/IP?
  208.  
  209. A)  Code from the Internetworking with TCP/IP Volume III is available
  210. for anonymous ftp from:
  211.  
  212. arthur.cs.purdue.edu:/pub/dls
  213.  
  214. Code used in the Net-2 version of Berkeley Unix is available for
  215. anonymous ftp from:
  216.  
  217. ftp.uu.net:systems/unix/bsd-sources/sys/netinet 
  218.  
  219. and
  220.  
  221. gatekeeper.dec.com:/pub/BSD/net2/sys/netinet
  222.  
  223. Code from Richard Steven's book is available on:
  224. ftp.uu.net:/published/books/stevens.*
  225.  
  226. Example source code and libraries to make coding quicker is available
  227. in the Simple Sockets Library written at NASA.  The Simple Sockets
  228. Library makes sockets easy to use!  And, it comes as source code.  It
  229. has been tested on: Unix (SGI, DecStation, AIX, Sun 3, Sparcstation;
  230. version 2.02+: Solaris 2.1, SCO), VMS, and MSDOS (client only since
  231. there's no background there).  It is provided in source code form, of
  232. course, and sits atop Berkeley sockets and tcp/ip.
  233.  
  234. You can order the "Simple Sockets Library" from
  235.  
  236.                            Austin Code Works
  237.                           11100 Leafwood Lane
  238.                        Austin, TX 78750-3464 USA
  239.                          Phone (512) 258-0785
  240.                  
  241. Ask for the "SSL - The Simple Sockets Library".  Last I checked, they
  242. were asking $20 US for it.
  243.  
  244.  
  245. For DOS there is WATTCP.ZIP (numerous sites): 
  246.  
  247. WATTCP is a DOS TCP/IP stack derived from the NCSA Telnet program and
  248. much enhanced. It comes with some example programs and complete source
  249. code. The interface isn't BSD sockets but is well suited to PC type
  250. work. It is also written so that it can be used and memory
  251. allocation).
  252.  
  253. 3)  Are there any public domain programs to check the performance of
  254. an IP link?
  255.  
  256. A)  
  257.  
  258. TTCP:  Available for anonymous ftp from....
  259.  
  260. wuarchive.wustl.edu:/graphics/graphics/mirrors/sgi.com/sgi/src/ttcp
  261.  
  262. On ftp.sgi.com are netperf (from Rick Jones at HP) and nettest
  263. (from Dave Borman at Cray).  ttcp is also availabel at ftp.sgi.com.
  264.  
  265. You can get to the NetPerf home page via:
  266.  
  267. http://www.cup.hp.com/netperf/NetperfPage.html
  268.  
  269.  
  270. There is suite of Bandwidth Measuring programs from gnn@netcom.com.
  271. Available for anonymous ftp from ftp.netcom.com in
  272. ~ftp/gnn/bwmeas-0.3.tar.Z These are several programs that meausre
  273. bandwidth and jitter over several kinds of IPC links, including TCP
  274. and UDP.
  275.  
  276.  
  277. 4) Where do I find RFCs?
  278.  
  279. A)  This is the latest info on obtaining RFCs:
  280. Details on obtaining RFCs via FTP or EMAIL may be obtained by sending
  281. an EMAIL message to rfc-info@ISI.EDU with the message body 
  282. help: ways_to_get_rfcs.  For example:
  283.  
  284.         To: rfc-info@ISI.EDU
  285.         Subject: getting rfcs
  286.  
  287.         help: ways_to_get_rfcs
  288.  
  289. The response to this mail query is quite long and has been omitted.
  290.  
  291. RFCs can be obtained via FTP from DS.INTERNIC.NET, NIS.NSF.NET,
  292. NISC.JVNC.NET, FTP.ISI.EDU, WUARCHIVE.WUSTL.EDU, SRC.DOC.IC.AC.UK,
  293. FTP.CONCERT.NET, or FTP.SESQUI.NET.
  294.  
  295.  
  296. Using Web, WAIS, and gopher:
  297.  
  298. Web:
  299.  
  300. http://web.nexor.co.uk/rfc-index/rfc-index-search-form.html
  301.  
  302. WAIS access by keyword:
  303.  
  304. wais://wais.cnam.fr/RFC
  305.  
  306. Excellent presentation with a full-text search too:
  307.  
  308. http://www.cis.ohio-state.edu/hypertext/information/rfc.html
  309.  
  310. With Gopher:
  311.  
  312. gopher://r2d2.jvnc.net/11/Internet%20Resources/RFC
  313. gopher://muspin.gsfc.nasa.gov:4320/1g2go4%20ds.internic.net%2070%201%201/.ds/
  314. .internetdocs
  315.  
  316.  
  317.  
  318. 5) How can I detect that the other end of a TCP connection has crashed?
  319. Can I use "keepalives" for this?
  320.  
  321. A) Detecting crashed systems over TCP/IP is difficult.  TCP doesn't require
  322. any transmission over a connection if the application isn't sending
  323. anything, and many of the media over which TCP/IP is used (e.g. ethernet)
  324. don't provide a reliable way to determine whether a particular host is up.
  325. If a server doesn't hear from a client, it could be because it has nothing
  326. to say, some network between the server and client may be down, the server
  327. or client's network interface may be disconnected, or the client may have
  328. crashed.  Network failures are often temporary (a thin ethernet will appear
  329. down while someone is adding a link to the daisy chain, and it often takes
  330. a few minutes for new routes to stabilize when a router goes down), and TCP
  331. connections shouldn't be dropped as a result.
  332.  
  333. Keepalives are a feature of the sockets API that requests that an empty
  334. packet be sent periodically over an idle connection; this should evoke an
  335. acknowledgement from the remote system if it is still up, a reset if it has
  336. rebooted, and a timeout if it is down.  These are not normally sent until
  337. the connection has been idle for a few hours.  The purpose isn't to detect
  338. a crash immediately, but to keep unnecessary resources from being allocated
  339. forever.
  340.  
  341. If more rapid detection of remote failures is required, this should be
  342. implemented in the application protocol.  There is no standard mechanism
  343. for this, but an example is requiring clients to send a "no-op" message
  344. every minute or two.  An example protocol that uses this is X Display
  345. Manager Control Protocol (XDMCP), part of the X Window System, Version 11;
  346. the XDM server managing a session periodically sends a Sync command to the
  347. display server, which should evoke an application-level response, and
  348. resets the session if it doesn't get a response (this is actually an
  349. example of a poor implementation, as a timeout can occur if another client
  350. "grabs" the server for too long).
  351.  
  352. 6) Can the keepalive timeouts be configured?
  353.  
  354. A) This varies by operating system.  There is a program that works on
  355. many Unices (though not Linux or Solaris), called netconfig, that
  356. allows one to do this and documents many of the variables.  It is
  357. available by anonymous FTP from
  358.  
  359.     cs.ucsd.edu:pub/csl/Netconfig/netconfig2.2.tar.Z
  360.  
  361. In addition, Richard Stevens' TCP/IP Illustrated, Volume 1 includes a
  362. good discussion of setting the most useful variables on many
  363. platforms.
  364.  
  365.  
  366. 7) Can I set up a gateway to the Internet that translates IP addresses, so
  367. that I don't have to change all our internal addresses to an official
  368. network?
  369.  
  370. A) There's no general solution to this.  Many protocols include IP
  371. addresses in the application-level data (FTP's "PORT" command is the most
  372. notable), so it isn't simply a matter of translating addresses in the IP
  373. header.  Also, if the network number(s) you're using match those assigned
  374. to another organization, your gateway won't be able to communicate with
  375. that organization (RFC 1597 proposes network numbers that are reserved for
  376. private use, to avoid such conflicts, but if you're already using a
  377. different network number this won't help you).
  378.  
  379. However, if you're willing to live with limited access to the Internet from
  380. internal hosts, the "proxy" servers developed for firewalls can be used as
  381. a substitute for an address-translating gateway. See the firewall FAQ.
  382.  
  383. 8) Are there object-oriented network programming tools?
  384.  
  385. A) Yes, and one such system is called ACE (ADAPTIVE Communication
  386. Environment).  Here is how to get more information and the software:
  387.  
  388. OBTAINING ACE
  389.  
  390. An HTML version of this README file is available at URL
  391. http://www.cs.wustl.edu/~schmidt/ACE.html.  All software and
  392. documentation is available via both anonymous ftp and the Web.
  393.  
  394. ACE is available for anonymous ftp from the ics.uci.edu (128.195.1.1)
  395. host in the gnu/C++_wrappers.tar.Z file (approximately .5 meg
  396. compressed).  This release contains contains the source code,
  397. documentation, and example test drivers for C++ wrapper libras.
  398.  
  399. 9) What other FAQs might you want to look in?
  400. comp.protocols.tcp-ip.ibmpc
  401.    Aboba, Bernard D.(1994) "comp.protocols.tcp-ip.ibmpc Frequently
  402.     Asked Questions (FAQ)" Usenet news.answers, available via
  403.     file://ftp.netcom.com/pub/ma/mailcom/IBMTCP/ibmtcp.zip,
  404.     57 pages.
  405.  
  406. comp.protocols.ppp
  407.    Archive-name: ppp-faq/part[1-8]
  408.    URL: http://cs.uni-bonn.de/ppp/part[1-8].html
  409.  
  410. comp.dcom.lans.ethernet
  411.    ftp site: dorm.rutgers.edu, pub/novell/DOCS
  412.    Ethernet Network Questions and Answers
  413.    Summarized from UseNet group comp.dcom.lans.ethernet
  414.  
  415. 10) What other newsgroups deal with networking?
  416.  
  417. comp.dcom.cabling       Cabling selection, installation and use.
  418. comp.dcom.isdn          The Integrated Services Digital Network
  419.             (ISDN).
  420. comp.dcom.lans.ethernet Discussions of the Ethernet/IEEE 802.3
  421.             protocols.
  422. comp.dcom.lans.fddi     Discussions of the FDDI protocol suite.
  423. comp.dcom.lans.misc     Local area network hardware and software.
  424. comp.dcom.lans.token-ring       Installing and using token ring
  425.                 networks.
  426. comp.dcom.servers       Selecting and operating data communications
  427.             servers.
  428. comp.dcom.sys.cisco     Info on Cisco routers and bridges.
  429. comp.dcom.sys.wellfleet Wellfleet bridge & router systems hardware &
  430.             software.
  431. comp.protocols.ibm      Networking with IBM mainframes.
  432. comp.protocols.iso      The ISO protocol stack.
  433. comp.protocols.kerberos The Kerberos authentication server.
  434. comp.protocols.misc     Various forms and types of protocol.
  435. comp.protocols.nfs      Discussion about the Network File System
  436.             protocol.
  437. comp.protocols.ppp      Discussion of the Internet Point to Point
  438.             Protocol.
  439. comp.protocols.smb      SMB file sharing protocol and Samba SMB
  440.             server/client.
  441. comp.protocols.tcp-ip   TCP and IP network protocols.
  442. comp.protocols.tcp-ip.ibmpc     TCP/IP for IBM(-like) personal
  443.                 computers.
  444. comp.security.misc      Security isuipment for the PC.
  445. comp.os.ms-windows.networking.misc      Windows and other networks.
  446. comp.os.ms-windows.networking.tcp-ip    Windows and TCP/IP networking.
  447. comp.os.ms-windows.networking.windows   Windows' built-in networking.
  448. comp.os.os2.networking.misc     Miscellaneous networking issues of
  449.                 OS/2.
  450. comp.os.os2.networking.tcp-ip   TCP/IP under OS/2.
  451. comp.sys.novell         Discussion of Novell Netware products.
  452.  
  453. 11) Van Jacobson explains TCP congestion avoidance.
  454.  
  455. I've attached Van J's original posting on it (I seem to repost this every
  456. 6 months or so).  If you want to see some real examples of this in action,
  457. take a look at Chapter 21 of my "TCP/IP Illustrated, Volume 1".
  458.  
  459.     Rich Stevens
  460.  
  461. ---------------------------------------------------------------------------
  462. >From van@helios.ee.lbl.gov Mon Apr 30 01:44:05 1990
  463. To: end2end-interest@ISI.EDU
  464. Subject: modified TCP congestion avoidance algorithm
  465. Date: Mon, 30 Apr 90 01:40:59 PDT
  466. From: Van Jacobson <van@helios.ee.lbl.gov>
  467. Status: RO
  468.  
  469. This is a description of the modified TCP congestion avoidance
  470. algorithm that I promised at the teleconference.
  471.  
  472. BTW, on re-reading, I noticed there were several errors in
  473. Lixia's note besides the problem I noted at the teleconference.
  474. I don't know whether that's because I mis-communicated the
  475. algorithm at dinner (as I recall, I'd had some wine) or because
  476. she's convinced that TCP is ultimately irrelevant :).  Either
  477. way, you will probably be disappointed if you experiment with
  478. what's in that note.
  479.  
  480. First, I should point out once again that there are two
  481. completely independent window adjustment algorithms running in
  482. the sender:  Slow-start is run when the pipe is empty (i.e.,
  483. when first starting or re-starting after a timeout).  Its goal
  484. is to get the "ack clock" started so packets will be metered
  485. into the network at a reasonable rate.  The other algorithm,
  486. congestion avoidance, is run any time *but* when (re-)starting
  487. and is responsible for estimating the (dynamically varying)
  488. pipesize.  You will cause yourself, or me, no end of confusion
  489. if you lump these separate algorithms (as Lixia's message did).
  490.  
  491. The modifications described here are only to the congestion
  492. avoidance algorithm, not to slow-start, and they are intended to
  493. apply to large bandwidth-delay product paths (though they don't
  494. do any harm on other paths).  Remember that with regular TCP (or
  495. with slow-start/c-a TCP), throughput really starts to go to hell
  496. when the probability of packet loss is on the order of the
  497. bandwidth-delay product.  E.g., you might expect a 1% packet
  498. loss rate to translate into a 1% lower throughput but for, say,
  499. a TCP connection with a 100 packet b-d p. (= window), it results
  500. in a 50-75% throughput loss.  To make TCP effective on fat
  501. pipes, it would be nice if throughput degraded only as function
  502. of loss probability rather than as the product of the loss
  503. probabilty and the b-d p.  (Assuming, of course, that we can do
  504. this without sacrificing congestion avoidance.)
  505.  
  506. These mods do two things: (1) prevent the pipe from going empty
  507. after a loss (if the pipe doesn't go empty, you won't have to
  508. waste round-trip times re-filling it) and (2) correctly account
  509. for the amount of data actually in the pipe (since that's what
  510. congestion avoidance is supposed to be estimating and adapting to).
  511.  
  512. For (1), remember that we use a packet loss as a signal that the
  513. pipe is overfull (congested) and that packet loss can be
  514. detected one of two different ways:  (a) via a retransmit
  515. timeout or (b) when some small number (3-4) of consecutive
  516. duplicate acks has been received (the "fast retransmit"
  517. algorithm).  In case (a), the pipe is guaranteed to be empty so
  518. we must slow-start.  In case (b), if the duplicate ack
  519. threshhold is small compared to the bandwidth-delay product, we
  520. will detect the loss with the pipe almost full.  I.e., given a
  521. threshhold of 3 packets and an LBL-MIT bandwidth-delay of around
  522. 24KB or 16 packets (assuming 1500 byte MTUs), the pipe is 75%
  523. full when fast-retransmit detects a loss (actually, until
  524. gateways start doing some sort of congestion control, the pipe
  525. is overfull when the loss is detected so *at least* 75% of the
  526. packets needed for ack clocking are in transit when
  527. fast-retransmit happens).  Since the pipe is full, there's no
  528. need to slow-start after a fast-retransmit.
  529.  
  530. For (2), consider what a duplicate ack means:  either the
  531. network duplicated a packet (i.e., the NSFNet braindead IBM
  532. token ring adapters) or the receiver got an out-of-order packet.
  533. The usual cause of out-of-order packets at the receiver is a
  534. missing packet.  I.e., if there are W packets in transit and one
  535. is dropped, the receiver will get W-1 out-of-order and
  536. (4.3-tahoe TCP will) generate W-1 duplicate acks.  If the
  537. `consecutive duplicates' threshhold is set high enough, we can
  538. reasonably assume that duplicate acks mean dropped packets.
  539.  
  540. But there's more information in the ack:  The receiver can only
  541. generate one in response to a packet arrival.  I.e., a duplicate
  542. ack means that a packet has left the network (it is now cached
  543. at the receiver).  If the sender is limitted by the congestion
  544. window, a packet can now be sent.  (The congestion window is a
  545. count of how many packets will fit in the pipe.  The ack says a
  546. packet has left the pipe so a new one can be added to take its
  547. place.)  To put this another way, say the current congestion
  548. window is C (i.e, C packets will fit in the pipe) and D
  549. duplicate acks have been received.  Then only C-D packets are
  550. actually in the pipe and the sender wants to use a window of C+D
  551. packets to fill the pipe to its estimated capacity (C+D sent -
  552. D received = C in pipe).
  553.  
  554. So, conceptually, the slow-start/cong.avoid/fast-rexmit changes
  555. are:
  556.  
  557.   - The sender's input routine is changed to set `cwnd' to `ssthresh'
  558.     when the dup ack threshhold is reached.  [It used to set cwnd to
  559.     mss to force a slow-start.]  Everything else stays the same.
  560.  
  561.   - The sender's output routine is changed to use an effective window
  562.     of min(snd_wnd, cwnd + dupacks*mss)  [the change is the addition
  563.     of the `dupacks*mss' term.]  `Dupacks' is zero until the rexmit
  564.     threshhold is reached and zero except when receiving a sequence
  565.     of duplicate acks.
  566.  
  567. The actual implementation is slightly different than the above
  568. because I wanted to avoid the multiply in the output routine
  569. (multiplies are expensive on some risc machines).  A diff of the
  570. old and new fastrexmit code is attached (your line numbers will
  571. vary).
  572.  
  573. Note that we still do congestion avoidance (i.e., the window is
  574. reduced by 50% when we detect the packet loss).  But, as long as
  575. the receiver's offered window is large enough (it needs to be at
  576. most twice the bandwidth-delay product), we continue sending
  577. packets (at exactly half the rate we were sending before the
  578. loss) even after the loss is detected so the pipe stays full at
  579. exactly the level we want and a slow-start isn't necessary.
  580.  
  581. Some algebra might make this last clear:  Say U is the sequence
  582. number of the first un-acked packet and we are using a window
  583. size of W when packet U is dropped.  Packets [U..U+W) are in
  584. transit.  When the loss is detected, we send packet U and pull
  585. the window back to W/2.  But in the round-trip time it takes
  586. the U retransmit to fill the receiver's hole and an ack to get
  587. back, W-1 dup acks will arrive (one for each packet in transit).
  588. The window is effectively inflated by one packet for each of
  589. these acks so packets [U..U+W/2+W-1) are sent.  But we don't
  590. re-send packets unless we know they've been lost so the amount
  591. actually sent between the loss detection and the recovery ack is
  592. U+W/2+W-1 - U+W = W/2-1 which is exactly the amount congestion
  593. avoidance allows us to send (if we add in the rexmit of U).  The
  594. recovery ack is for packet U+W so when the effective window is
  595. pulled back from W/2+W-1 to W/2 (which happens because the
  596. recovery ack is `new' and sets dupack to zero), we are allowed
  597. to send up to packet U+W+W/2 which is exactly the first packet
  598. we haven't yet sent.  (I.e., there is no sudden burst of packets
  599. as the `hole' is filled.)  Also, when sending packets between
  600. the loss detection and the recovery ack, we do nothing for the
  601. first W/2 dup acks (because they only allow us to send packets
  602. we've already sent) and the bottleneck gateway is given W/2
  603. packet times to clean out its backlog.  Thus when we start
  604. sending our W/2-1 new packets, the bottleneck queue is as empty
  605. as it can be.
  606.  
  607. [I don't know if you can get the flavor of what happens from
  608. this description -- it's hard to see without a picture.  But I
  609. was delighted by how beautifully it worked -- it was like
  610. watching the innards of an engine when all the separate motions
  611. of crank, pistons and valves suddenly fit together and
  612. everything appears in exactly the right place at just the right
  613. time.]
  614.  
  615. Also note that this algorithm interoperates with old tcp's:  Most
  616. pre-tahoe tcp's don't generate the dup acks on out-of-order packets.
  617. If we don't get the dup acks, fast retransmit never fires and the
  618. window is never inflated so everything happens in the old way (via
  619. timeouts).  Everything works just as it did without the new algorithm
  620. (and just as slow).
  621.  
  622. If you want to simulate this, the intended environment is:
  623.  
  624.     - large bandwidth-delay product (say 20 or more packets)
  625.  
  626.     - receiver advertising window of two b-d p (or, equivalently,
  627.       advertised window of the unloaded b-d p but two or more
  628.       connections simultaneously sharing the path).
  629.  
  630.     - average loss rate (from congestion or other source) less than
  631.       one lost packet per round-trip-time per active connection.
  632.       (The algorithm works at higher loss rate but the TCP selective
  633.       ack option has to be implemented otherwise the pipe will go empty
  634.       waiting to fill the second hole and throughput will once again
  635.       degrade at the product of the loss rate and b-d p.  With selective
  636.       ack, throughput is insensitive to b-d p at any loss rate.)
  637.  
  638. And, of course, we should always remember that good engineering
  639. practise suggests a b-d p worth of buffer at each bottleneck --
  640. less buffer and your simulation will exhibit the interesting
  641. pathologies of a poorly engineered network but will probably
  642. tell you little about the workings of the algorithm (unless the
  643. algorithm misbehaves badly under these conditions but my
  644. simulations and measurements say that it doesn't).  In these
  645. days of $100/megabyte memory, I dearly hope that this particular
  646. example of bad engineering is of historical interest only.
  647.  
  648.  - Van
  649.  
  650. -----------------
  651. *** /tmp/,RCSt1a26717    Mon Apr 30 01:35:17 1990
  652. --- tcp_input.c    Mon Apr 30 01:33:30 1990
  653. ***************
  654. *** 834,850 ****
  655.                    * Kludge snd_nxt & the congestion
  656.                    * window so we send only this one
  657. !                  * packet.  If this packet fills the
  658. !                  * only hole in the receiver's seq.
  659. !                  * space, the next real ack will fully
  660. !                  * open our window.  This means we
  661. !                  * have to do the usual slow-start to
  662. !                  * not overwhelm an intermediate gateway
  663. !                  * with a burst of packets.  Leave
  664. !                  * here with the congestion window set
  665. !                  * to allow 2 packets on the next real
  666. !                  * ack and the exp-to-linear thresh
  667. !                  * set for half the current window
  668. !                  * size (since we know we're losing at
  669. !                  * the current window size).
  670.                    */
  671.                   if (tp->t_timer[TCPT_REXMT] == 0 ||
  672. --- 834,850 ----
  673.                    * Kludge snd_nxt & the congestion
  674.                    * window so we send only this one
  675. !                  * packet.
  676. !                  *
  677. !                  * We know we're losing at the current
  678. !                  * window size so do congestion avoidance
  679. !                  * (set ssthresh to half the current window
  680. !                  * and pull our congestion window back to
  681. !                  * the new ssthresh).
  682. !                  *
  683. !                  * Dup acks mean that packets have left the
  684. !                  * network (they're now cached at the receiver) 
  685. !                  * so bump cwnd by the amount in the receiver
  686. !                  * to keep a constant cwnd packets in the
  687. !                  * network.
  688.                    */
  689.                   if (tp->t_timer[TCPT_REXMT] == 0 ||
  690. ***************
  691. *** 853,864 ****
  692.                   else if (++tp->t_dupacks == tcprexmtthresh) {
  693.                       tcp_seq onxt = tp->snd_nxt;
  694. !                     u_int win =
  695. !                         MIN(tp->snd_wnd, tp->snd_cwnd) / 2 /
  696. !                         tp->t_maxseg;
  697.   
  698.                       if (win < 2)
  699.                           win = 2;
  700.                       tp->snd_ssthresh = win * tp->t_maxseg;
  701.                       tp->t_timer[TCPT_REXMT] = 0;
  702.                       tp->t_rtt = 0;
  703. --- 853,864 ----
  704.                   else if (++tp->t_dupacks == tcprexmtthresh) {
  705.                       tcp_seq onxt = tp->snd_nxt;
  706. !                     u_int win = MIN(tp->snd_wnd,
  707. !                             tp->snd_cwnd);
  708.   
  709. +                     win /= tp->t_maxseg;
  710. +                     win >>= 1;
  711.                       if (win < 2)
  712.                           win = 2;
  713.                       tp->snd_ssthresh = win * tp->t_maxseg;
  714.                       tp->t_timer[TCPT_REXMT] = 0;
  715.                       tp->t_rtt = 0;
  716. ***************
  717. *** 866,873 ****
  718.                       tp->snd_cwnd = tp->t_maxseg;
  719.                       (void) tcp_output(tp);
  720.                       if (SEQ_GT(onxt, tp->snd_nxt))
  721.                           tp->snd_nxt = onxt;
  722.                       goto drop;
  723.                   }
  724.               } else
  725. --- 866,879 ----
  726.                       tp->snd_cwnd = tp->t_maxseg;
  727.                       (void) tcp_output(tp);
  728. !                     tp->snd_cwnd = tp->snd_ssthresh +
  729. !                                tp->t_maxseg *
  730. !                                tp->t_dupacks;
  731.                       if (SEQ_GT(onxt, tp->snd_nxt))
  732.                           tp->snd_nxt = onxt;
  733.                       goto drop;
  734. +                 } else if (tp->t_dupacks > tcprexmtthresh) {
  735. +                     tp->snd_cwnd += tp->t_maxseg;
  736. +                     (void) tcp_output(tp);
  737. +                     goto drop;
  738.                   }
  739.               } else
  740. ***************
  741. *** 874,877 ****
  742. --- 880,890 ----
  743.                   tp->t_dupacks = 0;
  744.               break;
  745. +         }
  746. +         if (tp->t_dupacks) {
  747. +             /*
  748. +              * the congestion window was inflated to account for
  749. +              * the other side's cached packets - retract it.
  750. +              */
  751. +             tp->snd_cwnd = tp->snd_ssthresh;
  752.           }
  753.           tp->t_dupacks = 0;
  754. *** /tmp/,RCSt1a26725    Mon Apr 30 01:35:23 1990
  755. --- tcp_timer.c    Mon Apr 30 00:36:29 1990
  756. ***************
  757. *** 223,226 ****
  758. --- 223,227 ----
  759.           tp->snd_cwnd = tp->t_maxseg;
  760.           tp->snd_ssthresh = win * tp->t_maxseg;
  761. +         tp->t_dupacks = 0;
  762.           }
  763.           (void) tcp_output(tp);
  764.  
  765. >From van@helios.ee.lbl.gov Mon Apr 30 10:37:36 1990
  766. To: end2end-interest@ISI.EDU
  767. Subject: modified TCP congestion avoidance algorithm (correction)
  768. Date: Mon, 30 Apr 90 10:36:12 PDT
  769. From: Van Jacobson <van@helios.ee.lbl.gov>
  770. Status: RO
  771.  
  772. I shouldn't make last minute 'fixes'.  The code I sent out last
  773. night had a small error:
  774.  
  775. *** t.c    Mon Apr 30 10:28:52 1990
  776. --- tcp_input.c    Mon Apr 30 10:30:41 1990
  777. ***************
  778. *** 885,893 ****
  779.                * the congestion window was inflated to account for
  780.                * the other side's cached packets - retract it.
  781.                */
  782. !             tp->snd_cwnd = tp->snd_ssthresh;
  783.           }
  784. -         tp->t_dupacks = 0;
  785.           if (SEQ_GT(ti->ti_ack, tp->snd_max)) {
  786.               tcpstat.tcps_rcvacktoomuch++;
  787.               goto dropafterack;
  788. --- 885,894 ----
  789.                * the congestion window was inflated to account for
  790.                * the other side's cached packets - retract it.
  791.                */
  792. !             if (tp->snd_cwnd > tp->snd_ssthresh)
  793. !                 tp->snd_cwnd = tp->snd_ssthresh;
  794. !             tp->t_dupacks = 0;
  795.           }
  796.           if (SEQ_GT(ti->ti_ack, tp->snd_max)) {
  797.               tcpstat.tcps_rcvacktoomuch++;
  798.               goto dropafterack;
  799.  
  800. 12) Can I use a single bit subnet?
  801.  
  802. A)  It would seem that the consensus is no.  The best citable answer
  803. follows.
  804.  
  805. >From RFC1122:
  806.       "3.3.6  Broadcasts
  807.          Section 3.2.1.3 defined the four standard IP broadcast address
  808.          forms:
  809.            Limited Broadcast:  {-1, -1}
  810.            Directed Broadcast:  {<Network-number>,-1}
  811.            Subnet Directed Broadcast:
  812.                               {<Network-number>,<Subnet-number>,-1}
  813.            All-Subnets Directed Broadcast: {<Network-number>,-1,-1}"
  814.  
  815. All-Subnets Directed broadcasts are being deprecated in favor of IP
  816. multicast, but were very much defined at the time RFC1122 was written.
  817. Thus a Subnet Directed Broadcast to a subnet of all ones is not
  818. distinguishable from an All-Subnets Directed Broadcast.
  819.  
  820. For those old systems that used all zeros for broadcast in IP addresses,
  821. a similar argument can be made against the subnet of all zeros.
  822.  
  823. Also, for old routing protocols like RIP, a route to subnet zero
  824. is not distinguishable from the route to the entire network number
  825. (except possibly by context).
  826.  
  827. Most of today's systems don't support variable length subnet masks
  828. (VLSM), and for such systems the above is true. However, all the major
  829. router vendors and *some* Unix systems (BSD 4.4 based ones) support
  830. VLSMs, and in that case the situation is more complicated :-)
  831.  
  832. With VLSMs (necessary to support CIDR, see RFC 1519), you can utilize the
  833. address space more efficiently. Routing lookups are based on *longest*
  834. match, and this means that you can for instance subnet the class C net
  835. with a mask of 255.255.255.224 (27 bits) in addition to the subnet mask
  836. of 255.255.255.192 (26 bits) given above. You will then be able to use
  837. the addresses x.x.x.33 through x.x.x.62 (first three bits 001) and the
  838. addresses x.x.x.193 through x.x.x.222 (first three bits 110) with this
  839. new subnet mask. And you can continue with a subnet mask of 28 bits, etc.
  840. (Note also, by the way, that non-contiguous subnet masks are deprecated.)
  841.  
  842. This is all very nicely covered in the paper by Havard Eidnes:
  843.  
  844.   Practical Considerations for Network Address using a CIDR Block Allocation
  845.   Proceedings of INET '93
  846.  
  847. This paper is available with anonymous FTP from
  848.  
  849.     aun.uninett.no:/pub/misc/eidnes-cidr.ps
  850.  
  851. The same paper, with minor revisions, is one of the articles in the
  852. special Internetworking issue of Communications of the ACM (last month,
  853. I believe).
  854.  
  855. > I have be told that some network equipment (Cisco I think was the vendor 
  856. > named) will not correctly handle subnets that violated that standard.
  857. As far as I know cisco is one of the router vendors that *do* handle
  858. VLSMs correctly. Could you substantiate this claim?
  859.  
  860. Steinar Haug, SINTEF RUNIT, University of Trondheim, NORWAY
  861. Email: Steinar.Haug@runit.sintef.no
  862.  
  863. -- 
  864. George V. Neville-Neil        work: gnn@wrs.com     home:gnn@netcom.com
  865. NIC: GN82
  866.     
  867. This signature kept blank due to the CDA.
  868.  
  869.  
  870.